<template>
  <div class="home-container">
    <div class="main-container">
      <div class="left-container">
        <div class="title">
          <img src="../../assets/img/logo.png" alt="">
          <span>云顶书院学员管理系统</span>
        </div>
        <div class="catalogue">
          <div class="catalogue-item" @click="tabName='activity-announcement'" tabindex="0">
            <div class="catalogue-item-whole">
              <span>活动公告</span>
              <div class="iconfont icon">&#xe6bd;</div>
            </div>
          </div>
          <!-- <div class="catalogue-item" @click="tabName='department-management'" tabindex="0">
            <div class="catalogue-item-whole">
              <span>部门管理</span>
              <div class="iconfont icon">&#xe602;</div>
            </div>
          </div>
          <div class="catalogue-item" @click="tabName='minister-management'" tabindex="0">
            <div class="catalogue-item-whole">
              <span>部长管理</span>
              <div class="iconfont icon">&#xe702;</div>
            </div>
          </div> -->
          <div class="catalogue-item" @click="tabName='self-information'" tabindex="0">
            <div class="catalogue-item-whole">
              <span>信息完善</span>
              <div class="iconfont icon">&#xe61b;</div>
            </div>
          </div>
          <!-- <div class="catalogue-item" @click="tabName='search-student'" tabindex="0">
            <div class="catalogue-item-whole">
              <span class="span-short">查询</span>
              <div class="iconfont icon">&#xe63f;</div>
            </div>
          </div> -->
          <!-- <div class="catalogue-item" @click="tabName='photo'" tabindex="0">
            <div class="catalogue-item-whole">
              <span class="span-short">照片</span>
              <div class="iconfont icon">&#xe65e;</div>
            </div>
          </div> -->
          <div class="signOut">
            <span class="signOutSpan">用户 · {{this.userName}}</span>
            <span class="iconfont signOutIcon" @click="signOut">&#xe612;</span>
          </div>
        </div>
      </div>
      <div class="right-container">
        <div class="right-inset-container">
          <component :is='tabName'></component>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import ActivityAnnouncement from '../modules/activityAnnouncement.vue';
// import DepartmentManagement from '../userModules/departmentManagement.vue';
// import MinisterManagement from '../userModules/ministerManagement.vue';
import SelfInformation from '../userModules/selfInformation.vue';
// import SearchStudent from '../userModules/searchStudent.vue';
// import Photo from '../modules/photo.vue';

import config from '../../action/config.js';
import axios from 'axios';

export default {
  name:'app',
  components:{
    ActivityAnnouncement,
    // DepartmentManagement,
    // MinisterManagement,
    SelfInformation,
    // SearchStudent,
    // Photo,
  },
  data() {
    return {
      tabName:'activity-announcement',
      userName: localStorage.getItem('userName'),
    };
  },
  methods:{
    signOut(){
      this.$axios.$post(config.api.post.User.userSignOut,{},{headers:{ORDER_ACCESS_TOKEN:localStorage.getItem('token')}})
        .then((response)=>{
          if(response.code == 0){
            this.$message({
              type: 'success',
              message: '退出成功!',
            });
            this.$router.push('/userSignIn');
          }else if(response.code == -1){
            console.log("退出失败");
            this.$message.error(response.message);
          }
      });
    },
    
  },
  // mounted(){
  //   this.getUserInfo();
  // }
}
</script>

<style>
  .home-container{
    width: 100%;
    height: 722px;
    background-image: url('../../assets/img/a.jpg');
  }
  .main-container{
    width: 100%;
    height: 700px;
    padding-top: 20px;
  }
  .left-container{
    float: left;
    height: 650px;
    width: 26%;
    margin-left: 2%;
  }
  .title{
    height: 130px;
    width: 100%;
  }
  .title img{
    width: 130px;
    height: width;
  }
  .title span{
    font-size:22px;
    line-height: 130px;
    font-weight: 500;
    color:#fff;
    margin-left: 3%;
  }
  .catalogue{
    width: 70%;
    height: 490px;
    margin: 0 auto;
    background-color: #393F4E;
    border-radius: 10px;
    margin-top: 24px;
    box-shadow: 2px 2px 2px #111111 inset;
    padding-top: 3px;
  }
  .catalogue-item{
    width: 98%;
    height: 54px;
    margin:0 auto;
    line-height: 54px;
    font-weight: 400;
    color:#fff;
    cursor: pointer;
    border-bottom: 3px #5f636a4a groove;
    outline: none;
  }
  .catalogue-item-whole{
    width: 40%;
    height: 54px;
    margin:0 auto;
  }
  .catalogue-item span{
    font-size:18px;
  }
  .signOut{
    margin-top: 277px;
    text-align: center;
  }
  .signOutSpan{
    color: #fff;
    font-size: 20px;
    font-weight: 500;
  }
  .signOutIcon{
    color: #fff;
    font-size: 24px;
    margin-left: 30px;
    cursor: pointer;
  }
  .signOutIcon:hover{
    color: #4ca4df;
  }
  .span-short{
    margin-left: 16%;
  }
  .icon{
    display: inline-block;
    font-size: 18px;
    margin-left: 6%;
  }
  .catalogue-item:first-child{
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
  }
  .catalogue-item:hover{
    background-color: #4f99df;
    box-shadow: 1px 2px 2px #292929 inset;
  }
  .catalogue-item:focus{
    background-color: #5356e2;
  }
  .catalogue-item:active{
    background-color: #419eeb;
  }
  .right-container{
    float: right;
    height: 670px;
    width: 70%;
    margin-right: 2%;
    background-image: url('../../assets/img/background.jpg');
    border-radius: 36px;
    box-shadow: 6px 6px 16px #000;
  }
  .right-inset-container{
    height: 580px;
    width: 90%;
    margin:0 auto;
    margin-top: 60px;
    border-radius: 8px;
    background-color: #35a3e2da;
    box-shadow: 4px 4px 6px rgba(19, 18, 18, 0.67);
  }

</style>